package com.feihao.zhou.dao;

import com.feihao.zhou.domain.Account;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface AccountDao {
    @Insert("INSERT INTO account VALUES (null,#{name},#{money})")
    void save(Account account);

    @Delete("DELETE FROM account where id = #{id}")
    void delete(Integer id);

    @Update("update account set name=#{name}, money=#{money} where id= #{id}")
    void update(Account account);

    @Select(" SELECT * from account")
    List<Account> findAll();

    @Select(" SELECT * from account where id =#{id}")
    Account findById(Integer id);

    @Update(" update account set  money= money + #{money} where name=#{name}")
    void transfer(@Param("name") String name, @Param("money") Double money);
}
